package com.ruoyi.project.deploy;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.PageDomain;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.framework.web.page.TableSupport;
import com.ruoyi.project.experimentresult.controller.TbExperimentResultController;
import com.ruoyi.project.property.domain.LabProperty;
import com.ruoyi.project.property.service.ILabPropertyService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

@Controller
@RequestMapping("website/deploy")
public class deployController extends BaseController {
    private String prefix = "system/deploy";
    @Autowired
    private ILabPropertyService labPropertyService;

    @RequiresPermissions("website:deploy:view")
    @GetMapping()
    public String deploy()
    {
        return prefix + "/deploy";
    }

    /**
     * 查询【请填写功能名称】列表
     */
    @RequiresPermissions("system:deploy:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(LabProperty labProperty)
    {
        TableDataInfo rspData = new TableDataInfo();
        List<deployController.TbDeploy> userList = new ArrayList<deployController.TbDeploy>(Arrays.asList(new deployController.TbDeploy[deploys.size()]));
        Collections.copy(userList, deploys);
        PageDomain pageDomain = TableSupport.buildPageRequest();
        if (null == pageDomain.getPageNum() || null == pageDomain.getPageSize())
        {
            rspData.setRows(userList);
            rspData.setTotal(userList.size());
            return rspData;
        }
        Integer pageNum = (pageDomain.getPageNum() - 1) * 10;
        Integer pageSize = pageDomain.getPageNum() * 10;
        if (pageSize > userList.size())
        {
            pageSize = userList.size();
        }
        rspData.setRows(userList.subList(pageNum, pageSize));
        rspData.setTotal(userList.size());
        return rspData;
    }


    private final static List<deployController.TbDeploy> deploys= new ArrayList<deployController.TbDeploy>();
    {
        deploys.add(new deployController.TbDeploy(1L,"生物质发电虚拟仿真实验","生物质发电虚拟仿真实验","2019-09-10","2019-09-10","李老师","已发布","10"));
        deploys.add(new deployController.TbDeploy(1L,"生物质发电虚拟仿真实验","生物质发电虚拟仿真实验","2019-09-10","2019-09-10","李老师","已发布","10"));
        deploys.add(new deployController.TbDeploy(1L,"生物质发电虚拟仿真实验","生物质发电虚拟仿真实验","2019-09-10","2019-09-10","李老师","已发布","10"));
        deploys.add(new deployController.TbDeploy(1L,"生物质发电虚拟仿真实验","生物质发电虚拟仿真实验","2019-09-10","2019-09-10","李老师","已发布","10"));
        deploys.add(new deployController.TbDeploy(1L,"生物质发电虚拟仿真实验","生物质发电虚拟仿真实验","2019-09-10","2019-09-10","李老师","已发布","10"));
        deploys.add(new deployController.TbDeploy(1L,"生物质发电虚拟仿真实验","生物质发电虚拟仿真实验","2019-09-10","2019-09-10","李老师","已发布","10"));
        deploys.add(new deployController.TbDeploy(1L,"生物质发电虚拟仿真实验","生物质发电虚拟仿真实验","2019-09-10","2019-09-10","李老师","已发布","10"));
        deploys.add(new deployController.TbDeploy(1L,"生物质发电虚拟仿真实验","生物质发电虚拟仿真实验","2019-09-10","2019-09-10","李老师","已发布","10"));
        deploys.add(new deployController.TbDeploy(1L,"生物质发电虚拟仿真实验","生物质发电虚拟仿真实验","2019-09-10","2019-09-10","李老师","已发布","10"));

    }
    class  TbDeploy{
        /** $column.columnComment */
        private Long id;

        public Long getId() {
            return id;
        }

        public void setId(Long id) {
            this.id = id;
        }

        public String getExperimentName() {
            return experimentName;
        }

        public void setExperimentName(String experimentName) {
            this.experimentName = experimentName;
        }

        public String getCourseName() {
            return courseName;
        }

        public void setCourseName(String courseName) {
            this.courseName = courseName;
        }

        public String getExperimentStartTime() {
            return experimentStartTime;
        }

        public void setExperimentStartTime(String experimentStartTime) {
            this.experimentStartTime = experimentStartTime;
        }

        public String getExperimentEndTime() {
            return experimentEndTime;
        }

        public void setExperimentEndTime(String experimentEndTime) {
            this.experimentEndTime = experimentEndTime;
        }

        public String getCreaTor() {
            return creaTor;
        }

        public void setCreaTor(String creaTor) {
            this.creaTor = creaTor;
        }

        public String getStaTus() {
            return staTus;
        }

        public void setStaTus(String staTus) {
            this.staTus = staTus;
        }

        public String getNumBer() {
            return numBer;
        }

        public void setNumBer(String numBer) {
            this.numBer = numBer;
        }

        /** 实验名称 */
        private String experimentName;

        /** 课程名称 */
        private String courseName;

        /** 实验开始时间 */
        private String experimentStartTime;

        /** 实验结束时间 */
        private String experimentEndTime;


        /** 创建者*/
        private String creaTor;
        /** 状态*/
        private String staTus;
        /** 预约人数*/
        private String numBer;



        public TbDeploy(Long id, String experimentName, String courseName, String experimentStartTime, String experimentEndTime,String creaTor,String staTus,String numBer) {
            this.id = id;
            this.experimentName = experimentName;
            this.courseName = courseName;
            this.experimentStartTime = experimentStartTime;
            this.experimentEndTime= experimentEndTime;
            this.creaTor= creaTor;
            this.staTus=staTus;
            this.numBer=numBer;

        }


    }
}
